/*
 * @Author: zhanglianchang
 * @Date: 2020-08-01 14:39:32
 * @Last Modified by: taoshiwei
 * @Last Modified time: 2019-04-29 14:49:44
 *
 * 题库有关的接口：自己写吧~~  已经被张老师删了 ^_^
 */
import { createAPI } from "@/utils/request";

// 添加试题
export const addQuestions = params => createAPI("/questions", "post", params);
// 编辑试题
export const editQuestions = params =>
  createAPI(`/questions/${params.id}`, "put", params);
// 获取题组列表
export const randomsQuestions = params =>
  createAPI("/questions/randoms/", "get", params);
// 删除题组列表
export const delRandomsQuestions = data =>
  createAPI(`/questions/randoms/${data.id}`, "delete", data);

// 基础题库列表
export const questionsList = params => createAPI("/questions", "get", params);

// 获取基础题库详情
export const questionsListById = (data, isNext) =>
  createAPI(`/questions/${data}`, "get", isNext);

// 基础题库删除
export const deleteQuestionById = data => {
  createAPI(`/questions/${data.id}`, "delete", data);
};

// 加入精选题库
export const addChoice = data => {
  createAPI(`/questions/choice/${data.id}/${data.choiceState}`, "patch", data);
};

// 精选题库列表
export const choiceQuestionsList = params =>
  createAPI("/questions/choice", "get", params);

// 试题审核
export const checkQuestions = data =>
  createAPI(`/questions/check/${data.id}`, "post", data);

// 精选题库上下架
export const publishQuestions = data =>
  createAPI(`/questions/choice/${data.id}/${data.publishState}`, "post", data);
